﻿#include "event.h"
#include "eventfragment.h"
#include "smartmanager.h"
#include "ui_smartmanager.h"
#include "alltodolists.h"
#include "tomatoclockfragment.h"
#include "counter.h"
#include "calendarfragment.h"
#include "clockfragment.h"
#include <QGridLayout>
#include "counter.h"
SmartManager::SmartManager(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::SmartManager) {
    ui->setupUi(this);
//    QGridLayout *layout = new QGridLayout();
//    Event event;
//    event.setName("Event1");
//    event.setTime(QDateTime::currentDateTime());
//    event.setDescription("This is an evnet");
//    event.addPerson("Zhangsan");
//    event.setBellRing(DEFAULT);

//    for(int i = 0; i<10; i++) {
//        EventFragment *fragment = new EventFragment(event,nullptr);
//        fragment->setMinimumSize(QSize(fragment->geometry().width(),fragment->geometry().height()));
//        layout->addWidget(fragment,i,0);
////        if(i==9)layout.wi
//    }
//    ui->scrollArea->widget()->setLayout(layout);
//    QHBoxLayout *layout = new QHBoxLayout;
//    Counter *counter1=new Counter(this);
//    Counter *counter2 = new Counter(this);
//    Counter *counter3 = new Counter(this);
//    layout->addWidget(counter1,1);
//    layout->addWidget(counter2,2);
//    layout->addWidget(counter3,1);
//    ui->centralwidget->setLayout(layout);
}

SmartManager::~SmartManager() {
    delete ui;
}


void SmartManager::on_pushButton_clicked()
{
    ClockFragment *fragment = new ClockFragment();
    fragment->show();
}

void SmartManager::on_pushButton_3_clicked()
{
    AllTODOLists *fragment = new AllTODOLists();
    fragment->show();
}

void SmartManager::on_pushButton_2_clicked()
{
    CalendarFragment *fragment = new CalendarFragment(QDate::currentDate().year(),QDate::currentDate().month());
    fragment->show();
}

void SmartManager::on_pushButton_4_clicked()
{
    Counter *counter = new Counter();
    counter->show();
}

void SmartManager::on_pushButton_5_clicked()
{
    TomatoClockFragment *fragment = new TomatoClockFragment();
    fragment->show();
}

void SmartManager::on_pushButton_6_clicked()
{
    close();
}
